#include<iostream>
using namespace std;
int main()
{
	int arr[] = { 1,2,3,4,6,9,4,3,2,1 };
	int sz = sizeof(arr) / sizeof(arr[0]);
	int diff = 0;
	int k1 = 0;
	int k2 = 0;
	for (int i = 0; i < sz; i++) {
		diff ^= arr[i];
	}
	diff &= -diff;
	for (int i = 0; i < sz; i++) {
		if (diff & arr[i]) {
			k1 ^= arr[i];
		}
		else {
			k2 ^= arr[i];
		}
		}
	cout << k1 << endl;
	cout << k2 << endl;
	return 0;
}